package com.cui.project.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 资源调度建议表
 * @TableName resource_schedule_recommendation
 */
@TableName(value ="resource_schedule_recommendation")
@Data
public class ResourceScheduleRecommendation implements Serializable {
    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 接口ID（null表示全局）
     */
    @TableField("interface_info_id")
    private Long interfaceInfoId;

    /**
     * 建议生效时间
     */
    @TableField("recommendation_time")
    private Date recommendationTime;

    /**
     * 当前容量（实例数/并发数）
     */
    @TableField("current_capacity")
    private Integer currentCapacity;

    /**
     * 建议容量
     */
    @TableField("recommended_capacity")
    private Integer recommendedCapacity;

    /**
     * 预测QPS
     */
    @TableField("predicted_qps")
    private Integer predictedQps;

    /**
     * 置信度
     */
    @TableField("confidence_level")
    private BigDecimal confidenceLevel;

    /**
     * 建议原因
     */
    @TableField("reason")
    private String reason;

    /**
     * 状态：0-待处理，1-已应用，2-已忽略
     */
    @TableField("status")
    private Integer status;

    /**
     * 应用时间
     */
    @TableField("applied_at")
    private Date appliedAt;

    /**
     * 创建时间
     */
    @TableField("created_at")
    private Date createdAt;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ResourceScheduleRecommendation other = (ResourceScheduleRecommendation) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getInterfaceInfoId() == null ? other.getInterfaceInfoId() == null : this.getInterfaceInfoId().equals(other.getInterfaceInfoId()))
            && (this.getRecommendationTime() == null ? other.getRecommendationTime() == null : this.getRecommendationTime().equals(other.getRecommendationTime()))
            && (this.getCurrentCapacity() == null ? other.getCurrentCapacity() == null : this.getCurrentCapacity().equals(other.getCurrentCapacity()))
            && (this.getRecommendedCapacity() == null ? other.getRecommendedCapacity() == null : this.getRecommendedCapacity().equals(other.getRecommendedCapacity()))
            && (this.getPredictedQps() == null ? other.getPredictedQps() == null : this.getPredictedQps().equals(other.getPredictedQps()))
            && (this.getConfidenceLevel() == null ? other.getConfidenceLevel() == null : this.getConfidenceLevel().equals(other.getConfidenceLevel()))
            && (this.getReason() == null ? other.getReason() == null : this.getReason().equals(other.getReason()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getAppliedAt() == null ? other.getAppliedAt() == null : this.getAppliedAt().equals(other.getAppliedAt()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getInterfaceInfoId() == null) ? 0 : getInterfaceInfoId().hashCode());
        result = prime * result + ((getRecommendationTime() == null) ? 0 : getRecommendationTime().hashCode());
        result = prime * result + ((getCurrentCapacity() == null) ? 0 : getCurrentCapacity().hashCode());
        result = prime * result + ((getRecommendedCapacity() == null) ? 0 : getRecommendedCapacity().hashCode());
        result = prime * result + ((getPredictedQps() == null) ? 0 : getPredictedQps().hashCode());
        result = prime * result + ((getConfidenceLevel() == null) ? 0 : getConfidenceLevel().hashCode());
        result = prime * result + ((getReason() == null) ? 0 : getReason().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getAppliedAt() == null) ? 0 : getAppliedAt().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", interfaceInfoId=").append(interfaceInfoId);
        sb.append(", recommendationTime=").append(recommendationTime);
        sb.append(", currentCapacity=").append(currentCapacity);
        sb.append(", recommendedCapacity=").append(recommendedCapacity);
        sb.append(", predictedQps=").append(predictedQps);
        sb.append(", confidenceLevel=").append(confidenceLevel);
        sb.append(", reason=").append(reason);
        sb.append(", status=").append(status);
        sb.append(", appliedAt=").append(appliedAt);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}